package vg.services.log_manager.realization;

import vg.services.log_manager.interfaces.ILog;
/**
 * This class realizes interface ILog.
 * Messages are displayed on standard output. 
 * @author tzolotuhin
 */
public class SimpleLog implements ILog {
	public void printDebug(String message) {
		System.out.print("[DEBUG] : "+message+"\n");
	}
	public void printError(String message) {
		System.out.print("[ERROR] : "+message+"\n");
	}
	public void printInfo(String message) {
		System.out.print("[INFO] : "+message+"\n");
	}
	public void printStackTrace(StackTraceElement[] trace) {
		if (trace == null)
			return;
		System.out.print("[TRACE START]\n");
		for (int i = 0; i < trace.length; i++) {
			System.out.print("[TRACE] : " + trace[i].toString() + "\n");
		}
		System.out.print("[TRACE END]\n");
	}
	public void printException(Throwable ex) {
		if (ex == null)
			return;
		System.out.println("[TRACE START] Message = " + ex.getMessage());
		for (int i = 0; i < ex.getStackTrace().length; i++) {
			System.out.println("[TRACE] : " + ex.getStackTrace()[i].toString());
		}
		System.out.println("[TRACE END]");		
	}
	public String getLoggerInfo() {
		return("This is simple logger. It uses standart output.");
	}
}
